package com.water.service.staticservice;

import com.water.aop.Aop;
import com.water.service.IService;
import com.water.service.TeamService;

/**
 * @author wsj
 * @version 1.0
 * @description: TODO
 * @date 2022/1/9 13:30
 */
public class ProxyAopService implements IService {
    private Aop aop ;
    private IService service; //核心业务

    public ProxyAopService(Aop aop,IService service){
        this.aop = aop;
        this.service = service;
    }

    @Override
    public void add() {
        try{
            aop.before();
            service.add();
            aop.after();
        }catch (Exception e){
            aop.exception();
        }finally {
            aop.myFinally();
        }

    }
}
